'use strict'


var path = require('path')
var util = require('../libs/util.js')
var Wechat = require('../wechatd/wechat')
var wechat_file = path.join(__dirname,'../config/wechat.txt')
var wechat_ticket = path.join(__dirname,'../config/ticket.txt')

var config = {
	wechat:{
		appID:'wx8160271f23337a80',
		appSecret:'60aa12862933745112925fdfe5c90549',
		token:'090ca94ffb275c7fcbdb9cd3a890cd6b',
		getAccessToken:function() {
			return util.readFileSync(wechat_file)
		},
		saveAccessToken: function(data) {
			data = JSON.stringify(data)
			return util.writeFileSync(wechat_file,data)
		 	},
		getTicket: function() {
			return util.writeFileSync(wechat_ticket)
		 	},
		saveTicket: function(data) {
			data = JSON.stringify(data)
			return util.writeFileSync(wechat_ticket,data)
		 	},
		}
	}

	
exports.getWechat = function() {

var wechatApi = new Wechat(config.wechat)
	return wechatApi

}